import {I18Parse,CommonLang} from '@lowcode/jpaas-common-lib';
import jsLang from '../../../../../locales/lang/impl/form/jsLang';
let lang = jsLang;

let i18n=function (langKey,text) {
    return I18Parse.getI18Val(lang.jsLang.formulaScript,langKey, text)
}

let FormulaScript=[
    {
        name:i18n('tableFormula', '表间公式工具类'),
        children:[
            {
                name:i18n('inArray', '判断字符串是否在数组中'),
                script:`util.in("a",{"a","b"})`
            },
            {
                name:i18n('hasData', '判断表是否有数据'),
                script:`util.isExist`+i18n('tableName', "('表名','字段名',字段值)")
            },
            {
                name:i18n('dataSource', '判断表是否有数据(数据源)'),
                script:`util.isExist`+i18n('tableName', '("数据源别名","表名","字段名",字段值)')
            },
            {
                name:i18n('executeSQL', '执行SQL判断是否有数据'),
                script:`util.isExistBySql(String sql)`
            },
            {
                name:i18n('ifData', '执行SQL判断是否有数据(数据源)'),
                script:`util.isExistBySql(`+i18n('alias', '数据源别名')+`, sql)`
            },
            {
                name:i18n('obtainValue', "获取{label:'',value:''} 的label 数据"),
                script:`util.getLabel("{label:"",value:""}")`
            },
            {
                name:i18n('obtainValue', "获取{label:'',value:''} 的value 数据"),
                script:`util.getValue("{label:"",value:""}")`
            },
        ]
    }
]
export default FormulaScript;